package com.cpp.server.websocket;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

@Service
public class LongRunningService {

    @Async
    public void runLongTask() {
        try {
            Thread.sleep(5000); // 模拟耗时操作
            System.out.println("Long task completed.");

            // 任务完成，发送 WebSocket 消息
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        }
    }
}